/*
 *  Copyright 2015-2016, RenGu Technology (BeiJing) Co., Ltd.
 *  All right reserved.
 *
 *  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF RENGU TECHNOLOGY (BeiJing) CO., LTD.
 *
 *  THE CONTENTS OF THIS FILE MAY NOT BE DISCLOSED TO THIR PARTIES,
 *  COPIED OR DUPLICATED IN ANY FORM, IN WHOLE OR IN PART,
 *  WITHOUT THE PRIOR WRITTEN PERMISSION OF RENGU TECHNOLOGY (BeiJing) CO., LTD.
 *
 *  IntelligenceInitService
 *
 *  Edit History:
 *      wukefan Created on 2020年08月19日
 *
 */
package cc.rengu.igas.cops.core.service.trans.intelliroute;

import cc.rengu.igas.cops.common.constant.CopsProductVersion;
import cc.rengu.oltp.service.base.RadpService;
import cc.rengu.oltp.service.common.constant.AppParamConstant;
import cc.rengu.oltp.service.common.dao.SysParamMapper;
import cc.rengu.oltp.service.common.dao.impl.SysParamMapperImpl;
import cc.rengu.oltp.service.common.entity.SysParam;
import cc.rengu.oltp.utility.util.StringUtil;

/**
 * 加载智能路由其他相关信息
 *
 * @author wukefan
 * @version 1.0
 * @date 2020/8/19
 */
public class IntelligenceInitService extends RadpService {
    @Override
    protected int bizInit(String s) {
        try {
            SysParamMapper sysParamMapper = new SysParamMapperImpl();
            SysParam sysParam = sysParamMapper.selectSysParamByPrimaryKey(AppParamConstant.DEFAULT_INSTID, "ROUTE:SERVICE4", "CUSTOMER");
            if (null != sysParam && !StringUtil.isEmptyOrNull(sysParam.getParamValue())) {
                CopsProductVersion.VERSION = sysParam.getParamValue().toLowerCase();
            }
        } catch (Exception e) {
            rglog.error(cc.rengu.utility.base.StringUtil.ExceptionToString(e));
            return -1;
        }
        return 0;
    }

    @Override
    protected int bizProcess(String s, int i) {
        return 0;
    }

    @Override
    protected int bizTerminate(String s) {
        return 0;
    }
}
